1. Field of the Invention
The invention relates to microcontrollers having registers associated with different resources contained therein and, more particularly, to a method for efficiently determining changes in registers in such systems.
2. Description of the Related Art
As microcontrollers become more and more complex, the number of resources that make up the microcontroller has grown. The increase in system resources, coupled with increasing processor clock speeds, has placed new burdens on system developers and complicated the task of debugging new systems. For each new resource contained within a microcontroller or other processor-oriented system, numerous resource registers may be maintained.
Many system resources require management of a large number of registers. For example, typical systems that support direct memory access, or DMA, can maintain many DMA registers. DMA command registers, DMA mode registers, DMA request registers, DMA mask registers, DMA address registers, and DMA page registers are usually included in a microcontroller.
Different resources within a microcontroller are often developed and maintained by different design teams, often not even within the same company. This decentralization of design teams has not been well-suited to debugging of system resources. The need to provide support for developing and debugging a system is particularly acute within the embedded products industry, where specialized on-chip circuitry is often combined with a processor core.
System resources are typically debugged by reading all the registers of the resource after the microcontroller has stopped. The registers are then compared to a previously saved value in order to identify which registers have changed. Comparing each register in this serial fashion can be slow.
A microcontroller according to the present invention includes a register change summary resource. The register change summary resource is a register or group of registers that indicates whether other registers in the microcontroller have changed. The register change summary resource enables system programmers and debuggers to quickly obtain a summary of register changes throughout the system. The register change summary resource enables debugging to take place in an iterative manner, starting from a system level and working down to the resource level as necessary. The register change summary resource eliminates the need to scan all registers of a system to determine if any of their contents has changed. Thus, the register change summary resource is an efficient debugging and development tool.
In one embodiment, the register change summary resource employs a set of resource change registers and summary registers. A resource change register reflects writes to a system register. Thus, each system resource register is coupled to a bit of a resource change register. Alternatively, multiple registers can tie to a unique bit in the resource change register. Further, the resource change register bits can be responsive to other accesses to the monitored system resource registers, to writes that change the register, to writes that do not change the register, to reads of the register, or any combination of these accesses.
A summary register reflects changes to a resource change register. So, each resource change register is coupled to a bit in a summary register. For systems with multiple summary registers, the summary registers may also be coupled to bits in higher level summary registers. Subsequent levels of summary registers thus may be provided for systems with large numbers of registers to be monitored.
The register change summary resource further may contain one or more bit mask registers. This register allows changes in certain resource change or summary registers to trigger an interrupt. After the interrupt is polled by a processor of the microcontroller, the system debugger is informed by the bit mask register of which resource change register or summary register caused the interrupt.
The register change summary resource includes reset logic that enables a user to reset the resource change registers and the summary registers. Once the resource change registers are reset, they reflect the current state of their associated system registers. In this way, a user may initialize the register change summary resource for a new debug session after a register change analysis is complete.
The register change summary resource may also contain logic such that, once resource change or summary register changes, the associated bit in the resource change register or summary register is latched to a predetermined value. This ensures that, once a resource change register or summary register changes, the change is reflected in the register change summary resource and is only cleared upon reset by the user.
The register change summary resource may also include a software development port. This port permits dedicated access to the register change summary resource during debug of the system.
A register change summary resource permits a developer or debugger to systematically identify a system problem. The developer or debugger starts with a high-level overview of register changes that occurred. Then, systematically and iteratively, the developer or debugger applies closer scrutiny to the problem resource or register. Using this process, identification and scrutiny of certain registers in the system might be avoided.